<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>
<body>
    <div id="root"></div>
</body>
<script>
    // data & methods & computed & watcher
    const app = Vue.createApp({
        data(){
            return {
                message:"hello world",
                price: 2,
                count: 10
            }
        },
        watch:{
            price(current, prev){
                console.log("==watch=="+current+"--"+prev)
                this.total = this.count * current;
            }
        },
        computed: {
            total(){
               console.log(Date.now() + this.count);
                return this.price *  this.count;
            }
        },
        methods: {
            handlerClick(){
                this.count++;
            },
            formateString(str){
                return str.toUpperCase();
            },
            getTotal(){
                return "getTotal:"+Date.now()
                // return this.price * this.count;
            }
        },
        template:
        `
            // <div @click=handlerClick>{{formateString(message)}}</div>
            <div @click=handlerClick>{{total}} === {{getTotal()}}</div>
        `
    });
    const vm = app.mount("#root");
</script>
</html>